﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Silvermoon.Navigation;

namespace Silvermoon.Controls
{
    public static class PageExtender
    {

        [Obsolete]
        public static void NavigateTo(this Page fromPage, Page page, NavigationTransition transitionManager)
        {
            if (page == null) throw new ArgumentNullException("page");

            PageTransition pt = new PageTransition { Mode = transitionManager.ForwardMode, Source = transitionManager.HideCurrent, Target = transitionManager.ShowTarget };
            PageTransition pt2 = new PageTransition { Mode = transitionManager.BackMode, Source = transitionManager.HideTarget, Target = transitionManager.ShowCurrent };
            Type fromType = fromPage.GetType();
            Type toType = page.GetType();
            NavigationService.SetTransition(fromType, toType, pt);
            NavigationService.SetTransition(toType, fromType, pt2);

            fromPage.NavigateTo(page);
        }
    }
}
